package pl.PawelAndAlicja.badugiproject.main.Game;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class BiddingTest {

    private int myPool=2000, myBet;
    ArrayList pool;
    Bet betObject;
    
	@Before
	public void setUp() throws Exception {
	    pool = new ArrayList();
	    betObject = new Bet();
	}

	@Test
	public void testFirstBet() {
		
        betObject.addBet(500, pool);
 		int expected = 1100;
		Object obcject = pool.get(0);
		int current = (Integer) obcject;
		
        assertNotNull(pool);
 		assertEquals(expected,current);
	}

	@Test
	public void testCheck() {
	}

	@Test
	public void testRise() {
		myBet = 600;
        betObject.addBet(myBet, pool);
 		int expected = 1200;
		Object obcject = pool.get(0);
		int current = (Integer) obcject;
 		assertEquals(expected,current);
 		
 		myPool = myPool - myBet;
 		assertEquals(1400,myPool);

	}

	@Test
	public void testAllIn() {
		myBet = myPool;
        betObject.addBet(myPool, pool);
        myPool = myPool - myBet;
 		assertEquals(0,myPool);
 		
 		int expected = 2600;
		Object obcject = pool.get(0);
		int current = (Integer) obcject;
 		assertEquals(2600,obcject);
	}
	
	@Test
	public void testCall() {
		
		testFirstBet();
        Object myPoolBet = pool.get(0);
        int poolBetSize = (Integer) myPoolBet;

 		assertEquals(1100,poolBetSize);

 		if(myPool>poolBetSize){
            betObject.addBet(poolBetSize, pool);
    		Object obcject = pool.get(1);
    		int current = (Integer) obcject;
    		assertEquals(2200,current);
 		}
	}
	
	@Test
	public void testFold() {
        myPool=0;
		assertEquals(0,myPool);
	}
	
	@After
	public void tearDown() throws Exception {
	    pool = null;
	    betObject = null;
	}

}
